package com.societyGames.codeAlong.state.codeExercise.view
{
	public class EditorCloseEnum
	{
		public static const nextExercise:EditorCloseEnum = new EditorCloseEnum("nextExercise");
		public static const selectModuleData:EditorCloseEnum = new EditorCloseEnum("selectModuleData");
		
		//An internal display string for enum, also good for serialization.
		private var _name:String;
		
		//A special constructor for enum. Throws if attempted to instantiate outside of enum.
		public function EditorCloseEnum(name:String)
		{
			//If _done is true, we're instantiating after the static enum has finished, so fail.
			if (_done)
			{
				throw new Error("Cannot instantiate new enum.");
			}
			_name = name;
		}
		
		//Lock to indicate that static initialization is not complete.
		private static var _done:Boolean = false;
		
		//Static constructor
		{
			_done = true;
		}
	}
}